#pragma once
#include <iostream>
using namespace std;

class person
{
public:
    virtual void buy_ticket(int i = 1) { cout << "adult full price" << endl; }
    virtual ~person() { cout << "~person()" << endl; }
};

class student : public person
{
public:
    void buy_ticket(int i = 2) { cout << "child half price" << endl; }
    ~student() { cout << "~student()" << endl; }
};

void func_ref(person& p) { p.buy_ticket(); }

void func_ptr(person* p) { p->buy_ticket(); }

void test_1()
{
    person p;
    student s;
    func_ref(p);
    func_ref(s);

    func_ptr(&p);
    func_ptr(&s);
}

void test_2()
{
    // person p;
    // student s;

    test_1();

    person* p1 = new person;
    person* p2 = new student;

    delete p1;
    delete p2;
}

// class A final
// {};
//
// class B : public A
// {};

// class A
// {
//     virtual void func() final
//     {}
// };
//
// class B : public A
// {
//     void func()
//     {}
// };

class car
{
    virtual void func() = 0;
};

class tsla : public car
{
    virtual void func()
    {}
};

void test_3()
{
    // car c;
    tsla t;
}

class base
{
    virtual void func()
    {}
    int _i;
};

